#!/bin/bash

scriptPath="$(realpath "$0")"
basePath="$(dirname "$(dirname "${scriptPath}")")"

sourcePath="${basePath}/scripts/goland.env/workspace.xml"
aimPath="${basePath}/.idea/workspace.xml"

# 确保文件存在
if [ ! -f ${sourcePath} ]; then
  echo "${sourcePath} 文件不存在"
  exit 1
fi
# 确保文件不存在
if [ -f ${aimPath} ]; then
  echo "${aimPath} 文件存在，请手动删除"
  exit 1
fi

cp ${sourcePath} ${aimPath}

echo "使用${sourcePath}文件覆盖${aimPath}成功"